package com.shell.governor.modules.controller;

import com.shell.bee.base.annotation.Logging;
import com.shell.bee.entity.mvc.RetMsg;
import com.shell.bee.persistence.model.PageLimit;
import com.shell.governor.modules.po.PubMessage;
import com.shell.governor.modules.service.PubMessageService;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PubMessageController {
	@Autowired
	private PubMessageService messageService;

	@RequestMapping
	@Logging(module = "��������", methods = "��������")
	public RetMsg sendMessage(String title, String content, String receiverId, String receiverEntId) {
		return null;
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������")
	public RetMsg setPubMessageReaded(String messageIds) {
		String[] ids = messageIds.split("\\,");
		List<String> idlist = Arrays.asList(ids);
		return this.messageService.setPubMessageReaded(idlist);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������")
	public List<PubMessage> getMyMessagesByPage(PageLimit limit, PubMessage message) {
		return this.messageService.getMyMessagesByPage(limit, message);
	}

	@RequestMapping
	@Logging(module = "��������", methods = "������������")
	public Long getMyMessageNotReadedCount() {
		return this.messageService.getMyMessageNotReadedCount();
	}
}
